package com.sw.study.springmvc.pojo;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * Created by sw on 2020/4/9.
 */
public class Handler {
    /**
     * 实例信息
     */
    private Object controller;
    /**
     * 自行方法
     */
    private Method method;
    /**
     * spring 中url支持正则
     */
    private Pattern pattern;
    /**
     * 参数存放的顺序，为了参数绑定，key是参数名，value 代表第几个参数
     */
    private Map<String,Integer> paramIndexMapping;
    /**
     * 允许访问的用户信息
     */
    private String [] securityUsers;


    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Map<String, Integer> getParamIndexMapping() {
        return paramIndexMapping;
    }

    public void setParamIndexMapping(Map<String, Integer> paramIndexMapping) {
        this.paramIndexMapping = paramIndexMapping;
    }

    public Handler(Object controller, Method method, Pattern pattern) {
        this.controller = controller;
        this.method = method;
        this.pattern = pattern;
        this.paramIndexMapping = new HashMap<>();//完成初始化
    }

    public String[] getSecurityUsers() {
        return securityUsers;
    }

    public void setSecurityUsers(String[] securityUsers) {
        this.securityUsers = securityUsers;
    }
}